﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<IPagedList<MensUnoShop.Models.UNews>>" %>
<%@ Import Namespace="MvcPaging"%>  
<%@ Import Namespace="MensUnoShop.Helpers" %>
<%@ Import Namespace="MensUnoShop.Areas.Admin.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	最新消息管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

     <div id="main-content" class="hastable">
		    <div class="title title-spacing">
			    <h2>最新消息管理</h2>
		    </div>
            					<input type="button" onclick="location.href='/Admin/NewsSetup/add'" value="新增最新消息" />
            
            <table cellspacing="0" style="width:800px;">
            <thead>
				<tr>
					<td style="width:30px">序號</td>
					<td style="width:500px;text-align:left">標題</td>
                    <td style="width:100px">建立時間</td>
                    <td style="width:50px">狀態</td>
                    <td style="width:120px">操作</td>
				</tr>
			</thead>
            <%if (Model != null){%>
             <tbody>
            <%for (int i = 0; i < Model.Count;i++ )
              {  %>
        	    <tr>
                    <td class="center"><%:i+1%></td>
                    <td><a href="/Admin/NewsSetup/Setup/<%:Model[i].Nid %>"><%:Model[i].Ntitle%></a></td>
                    <td class="center"><%:Model[i].Ndatein.ToShortDateString()%></td>
                    <td class="center"><%:Model[i].Nstatus == true ? "顯示" : "隱藏"%></td>
                    <td>
                        <form action="" method="post" style="display:inline">
                            <input type="hidden" name="nid" value="<%:Model[i].Nid %>" />
                            <input type="hidden" name="act" value="upt" />
                            <%if (Model[i].Nstatus)
                              { %><input type="submit" name="cstatus" value="隱藏" /><%}
                              else
                              { %><input type="submit" name="cstatus" value="開啟" /><%} %>
                        </form>
                        <form action="" method="post" onsubmit="return confirm('確定刪除?');" style="display:inline">
                            <input type="hidden" name="nid" value="<%:Model[i].Nid %>" />
                            <input type="hidden" name="act" value="del" />
                            <input type="submit" name="cstatus" value="刪除" />
                        </form>
                    </td>
                </tr>
            <%} %>
            </tbody>
            <%} %>
            </table>
            <ul class="pagination" style="margin-top:-50px">
            <%= Html.UPager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)%>
            </ul>
            <br/><br/>　
        </div>

</asp:Content>
